package com.sam.im.heiqun.uis.activities;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.sam.im.heiqun.R;
import com.yuyh.library.uis.activitys.BaseSwipeBackActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by wangguodong on 2017/1/20.
 */
public class PhoneConstantActivity extends BaseSwipeBackActivity {

    @BindView(R.id.contact_layout)
    RelativeLayout contact_layout ;
    @BindView(R.id.linear_search)
    LinearLayout linear_search ;
    @BindView(R.id.pre_v_back)
    ImageView pre_v_back ;

    @Override
    public int getContentViewId() {
        return R.layout.add_page;
    }

    @OnClick({R.id.contact_layout,R.id.linear_search,R.id.pre_v_back})
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.pre_v_back :
                finish();
                break;
            case R.id.contact_layout :
                Intent contactIntent = new Intent(getApplicationContext(), ContactActivity.class);
                startActivity(contactIntent);
                break;
            case R.id.linear_search :
                startActivity(SeachFriendsActivity.class);
                break;
        }
    }

    @Override
    protected String getTitleText() {
        return getString(R.string.add_linkman);
    }

    @Override
    protected void initViews(Bundle savedInstanceState) {
        showContacts();
    }
/** 动态申请权限 */
    private void showContacts() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
            requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, 100);
        }
    }



}
